#include <iostream>
#include<string>
using std::cout;
using std::cin;
using std::endl;
using std::istream;
using std::string;
void checkStreamStatus(istream &cin ){
    cout<<"good:"<<cin.good()<<endl;
    cout<<"fail:"<<cin.fail()<<endl;
    cout<<"eof:"<<cin.eof()<<endl;
    cout<<"bad:"<<cin.bad()<<endl;
}
void test0(){
    checkStreamStatus(cin);
    int num;
    cin>>num;
    cout<<"num"<<num<<endl;
    checkStreamStatus(cin);
    if(cin.fail()){
        //恢复状态
        cin.clear();
        //还需要舍弃字符 并且把字符读完
        //因为错误之后缓冲区是保留上一次错误 之后的结果
        //
        //默认不写值是舍弃一个字符
        //包含两个参数 前者是舍弃多少g个
        //第二个是 遇到该字符 结束任务
        cin.ignore(30,'\n');
    }
    checkStreamStatus(cin);
    string x;
    cin>>x;
    cout<<x<<"**"<<endl;
}
int main()
{
    test0();
    std::cout << "Hello world" << std::endl;
    return 0;
}

